package b4.controller
{
	import b4.config.Config;
	import b4.config.TownConfig;
	import b4.model.ResourceLoader;
	import b4.model.SmartBirdExtension;
	
	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	public class LoadTownResourceCommand extends SimpleCommand implements ICommand
	{
		override public function execute(notification:INotification):void
		{
			var body:Object = notification.getBody();
			var townIndex:int = body.townIndex;
			var townConfig:TownConfig = Config.townConfigs[townIndex];
			var resourceLoader:ResourceLoader = new ResourceLoader("Town" + townIndex, ResourceLoader.TYPE_TOWN);
			resourceLoader.loadResources([townConfig.swfName, townConfig.xmlName]);
			facade.registerProxy(resourceLoader);
		}
	}
}